#include "QueryProcessorWrapper.h"


QueryProcessorWrapper::QueryProcessorWrapper(QueryPreprocessor *preprocessor, QueryEvaluator *evaluator, QueryProjector *projector) {
	mQueryPreprocessor = preprocessor;
	mQueryEvaluator = evaluator;
	mQueryProjector = projector;
}

QueryProcessorWrapper::~QueryProcessorWrapper(void) {
}

std::vector<string> QueryProcessorWrapper::evaluateQuery(string queryInput) {	
	//cout << "**********QueryProcessorWrapper BEGINS query evaluation\n";
	vector<string> results; 
	QueryTable queryTable; 
	//cout << "Created mQueryPreprocessor for queryInput\n";
	if (mQueryPreprocessor->preprocess(queryInput, &queryTable)) {
		//cout << "Valid query";
		results = mQueryEvaluator->evaluateQuery(queryTable); // evaluate the queryTable with the mQueryEvaluator
	} else {
		//cout << "Invalid query";
		// invalid query
	}
	//cout << "**********QueryProcessorWrapper ENDS query evaluation\n";
	//cout << "results size: " << results.size() << endl;
	return results;
}